package dk.eaaa.mobil2012.indkoebsappnyere;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class Details extends Fragment {
	
	TextView textname, textunit, textamount, textprice;
	MainActivity activity = (MainActivity) getActivity();

	
	static Details newIntance(){
		return new Details();
	}


	@Override
	public void onDetach() {
		getActivity().getActionBar().show();
		super.onDetach();
	}


	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.details_layout, container, false);
		textname = (TextView) v.findViewById(R.id.name);
		textunit = (TextView) v.findViewById(R.id.unit);
		textamount = (TextView) v.findViewById(R.id.amount);
		textprice = (TextView) v.findViewById(R.id.price);
		textname.setText(activity.getCurrentProduct().getName());
		textunit.setText(activity.getCurrentProduct().getUnit().toString());
		textamount.setText(activity.getCurrentProduct().getAmount()+"");
		textprice.setText(activity.getCurrentProduct().getPrice()+"");
		return v;
	}



}
